Skip to content

Improvements to Apple CgBI PNG handling#3137

Draft
Erik-White wants to merge 8 commits into
SixLabors:mainfrom
Erik-White:png-cgbi-improvements
Draft

Improvements to Apple CgBI PNG handling#3137
Erik-White wants to merge 8 commits into
SixLabors:mainfrom
Erik-White:png-cgbi-improvements

Conversation

@Erik-White
Copy link
Copy Markdown
Contributor

@Erik-White Erik-White commented May 27, 2026

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Following on from #3136 , this attempts to streamline and improve the related code as well as improve test coverage.

  • CgBI images that are not supported are now explicitly rejected (i.e. bit depth != 8 or truecolor)
  • Broke out ChunkedReadStream from ZlibInflateStream to separate the concerns instead of mixing modes in ZlibInflateStream
  • Broke out CgBI transform from PngDecoderCore into new PngCgbiProcessor static class
  • Added tests for PngCgbiProcessor
  • Small improvements to the CgBI shuffle methods (e.g. construct the shuffle patterns only once, remove redundant floor(), replace magic numbers where possible)

@Erik-White
Copy link
Copy Markdown
Contributor Author

Curious to hear your thoughts. The changes should all be relatively self-contained per commit in case there are sections that you don't think should be included.

@JimBobSquarePants
Copy link
Copy Markdown
Member

This looks like a lot of changes. Will take time to review

@Erik-White
Copy link
Copy Markdown
Contributor Author

Understood. As I mentioned in the description, each commit is fairly self contained but I could also break up the PR into a couple of smaller units if that would be helpful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants